package com.dlust;

import com.dlust.pojo.Customer;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;


public class Main {
    public static void main(String[] args) {
//        StandardServiceRegistry standardServiceRegistry = new StandardServiceRegistryBuilder()
//                .configure("/hibernate.cfg.xml").build();
//        SessionFactory sf = new MetadataSources(standardServiceRegistry).buildMetadata().buildSessionFactory();
//
//        Session session = sf.openSession();
//
//        Transaction tx = session.beginTransaction();
//
//        Customer customer = new Customer();
//        customer.setCustName("李克用");
//        customer.setCustAddress("大连旅顺口区");
//        session.save(customer);
//
//        tx.commit();
//        session.close();
//        sf.close();
    }
}